package com.omg.persistence.delegate.lifepoint;

import java.util.List;

import com.ibatis.dao.client.DaoManager;
import com.omg.persistence.dao.lifepoint.DaoConfig;
import com.omg.persistence.dao.lifepoint.entity.LPUser;
import com.omg.persistence.dao.lifepoint.iface.LPUserDao;

public class LPUserDelegate {

	private static volatile LPUserDelegate instance;
	private LPUserDao lpUserDao;
	private static final Object synObj = new Object();

	public static LPUserDelegate getInstance() {
		if (instance == null) {
			instance = new LPUserDelegate();
		}
		return instance;
	}

	private LPUserDelegate() {
		synchronized (synObj) {
			DaoManager daoMgr = DaoConfig.getDaoManager();
			this.lpUserDao = (LPUserDao) daoMgr.getDao(LPUserDao.class);
		}
	}

	public LPUser getLPUserByEmail(String email) {
		return this.lpUserDao.getLPUserByEmail(email);
	}

	public int updateLPUserSid(String userid, String sid) {
		return this.lpUserDao.updateLPUserSid(userid, sid);
	}

	public LPUser getLPUserByNickname(String nickname) {
		return this.lpUserDao.getLPUserByNickname(nickname);
	}

	public LPUser getLPUserBySid(String sid) {
		return this.lpUserDao.getLPUserBySid(sid);
	}

	public LPUser getLPUserByUserid(String userid) {
		return this.lpUserDao.getLPUserByUserid(userid);
	}

	public int addLPUser(LPUser lpUser) {
		return this.lpUserDao.addLPUser(lpUser);
	}

	public List<LPUser> getLPFriendsByUserid(String userid) {
		return this.lpUserDao.getLPFriendsByUserid(userid);
	}

	public List<LPUser> getAllLPUsers() {
		return this.lpUserDao.getAllLPUsers();
	}

}
